#! /bin/bash
gnuplot << EOF
set terminal postscript enhanced 25
set output '$1.ps'
set key left Left reverse
set yrange[0:200]
set key samplen 3
set style line 1 lt 1 pt 1 ps 2  lw 5 lc rgb "red" 
set style line 2 lt 2 pt 2 ps 2  lw 5 lc rgb "blue" 
set style line 3 lt 3 pt 6 ps 2  lw 5 lc rgb "black" 
set style line 4 lt 4 pt 4 ps 2  lw 5 lc rgb "orange" 
set style line 5 lt 5 pt 5 ps 2  lw 5 lc rgb "purple" 
set style line 6 lt 6 pt 6 ps 2  lw 5 lc rgb "green" 
set ylabel 'Execution Time (ms)'
plot "$1" using 1:2 with linespoints ls 1  title "HtoD",\
	"$1" using 1:3 with linespoints ls 2 title "DtoH", \
	"$1" using 1:4 with linespoints ls 3 title "Build", \
	"$1" using 1:5 with linespoints ls 4 title "Probe", \
	"$1" using 1:(\$6 + \$7) with linespoints ls 5 title "genResult",\
	"$1" using 1:8 with linespoints ls 6 title "otherKernelOp"
EOF
